function scale=choose_gen(x,dispcell); 
% ===============================
% CHOOSE_GEN
% X         Vector of admissible numeric answers
% DISPCELL  Cell or string with name for window 
% AJ October 24 2006 
% ====================================
x=x(:); 
n=length(x); 
if ~iscell(dispcell)
     dispcell=cellstr(dispcell);
end
cont=0;
st=['Min: ',num2str(min(x)),', Max:',num2str(max(x))]; 
def=cellstr(num2str(x(1))); 
while cont < 1;
    scale=inputdlg(dispcell,st,1,def,'on');
    if ~isempty(scale)
        scale=str2num(scale{:});
        cont=(any(x==scale));
    end
end
disp(['Choice :',num2str(scale)]); 